package com.yihen.controller;

import com.yihen.dto.BillDto;
import com.yihen.dto.Result;
import com.yihen.service.BillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/bills")
public class BillController {

    @Autowired
    private BillService billService;

    @GetMapping("/get/all")
    public Result getAllBillDto() {
        return billService.getAllBillDto();
    }

    @GetMapping("/get/id/{id}")
    public Result getBillDtoById(@PathVariable long id) {
        return billService.getBillById(id);
    }

    @GetMapping("/get/doctorid/{id}")
    public Result getBillDtoByDoctorId(@PathVariable long id) {
        return billService.getBillByDoctorId(id);
    }

    @GetMapping("/get/patientid/{id}")
    public Result getBillDtoByPatientId(@PathVariable long id) {
        return billService.getBillByPatientId(id);
    }

    @PostMapping("/get/conditon")
    public Result getBillsByCondition(@RequestBody BillDto dto) {
        return billService.getBillsByCondition(dto);
    }
}
